using System;
using System.Collections.Generic;
using System.Text;

using System.Xml;

namespace WMOSSExperts.PackageBuilder
{
    /// <summary>
    /// A Sharepoint assemnly item
    /// </summary>
    public class AssemblyItem:BaseSolutionItem
    {
        public enum DeploymentTargetValue
        {
            GlobalAssemblyCache,
            WebApplication
        }

        public override string XmlNodeName
        {
            get { return "Assembly"; }
        }

        public override string XmlParentNodeName
        {
            get
            {
                return "Assemblies";
            }
        }

        public DeploymentTargetValue DeploymentTarget
        {
            get
            {
                //TODO Manage the webApplication target
                return DeploymentTargetValue.GlobalAssemblyCache;
            }
        }

        public override void AddAditionalAttribute(System.Xml.XmlDocument doc, System.Xml.XmlNode solutionItemNode)
        {
            base.AddAditionalAttribute(doc, solutionItemNode);

            XmlAttribute deploymentAttribute = doc.CreateAttribute("DeploymentTarget");
            solutionItemNode.Attributes.Append(deploymentAttribute);
            deploymentAttribute.Value = this.DeploymentTarget.ToString();
        }

        private String _location;
        public override string Location
        {
            get
            {
                if (String.IsNullOrEmpty(_location)) _location = this.FileName;
                return _location;
            }
            set
            {
                _location = value;
            }
        }


    }
}
